package com.example.mangroves.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import com.example.mangroves.entity.GeoInfo;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface GeoInfoMapper extends BaseMapper<GeoInfo> {
    // 可以添加特定的数据库操作方法，但基本的CRUD已通过BaseMapper提供
    @Insert("INSERT INTO geo_info (latitude, longitude, altitude, station_name, model, serial_no, os_version, prog_name, transaction, signature, data_json) VALUES (#{latitude}, #{longitude}, #{altitude}, #{stationName}, #{model}, #{serialNo}, #{osVersion}, #{progName}, #{transaction}, #{signature}, #{dataJson})")
    int insertGeoInfo(GeoInfo geoInfo);

    @Select("SELECT LAST_INSERT_ID()")
    int getLastInsertId();

    @Select("SELECT * FROM geo_info ORDER BY id DESC LIMIT 1")
    GeoInfo findLastGeoInfo();

}

